home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-30 | 5.2 KB | 174 lines | [TEXT/MPS ] |
- //
- // myRuleFunction.r
- //
- // This example installs a "ReadMe" file to the folder
- // 'Rule Function Example:' at the root of the selected target volume.
- //
- // This example script uses a Rule Function to check the version of
- // the currently running operating system.
- //
- // NOTE: This is different from using an Installer "CheckFileVersion" call.
- // When "CheckFileVersion" is used to check the System version, the
- // target System file spec ('intf') supplied refers to the System file
- // in the directory "special-macs". That is the System file in the
- // blessed system folder on the _target HD_. Since users may have
- // different versions of system folders on different hard disks, the
- // boot volume may not be the target volume; thus, this is not
- // necessarily checking the version of the currently running operating
- // system!
- //
- // In addition, if no blessed system folder is found on the target volume,
- // the path "special-macs:" will default to ":System Folder:".
- // In the case where the user has removed the Finder file from folder named
- // "System Folder" that still contains a copy of the System file, the
- // "CheckFileVersion" check for an existing System version on the target
- // volume may be erroneous. (To avoid this, you could verify the existence
- // of both a System and Finder in "special-macs:" before you attempted to
- // check the System file version.)
- //
- // Copyright 1993-1996, Apple Computer, Inc., All Rights Reserved
- //
-
- #include "InstallerTypes.r"
-
- // include the file containing our Rule Function code resource item
- // - note that since this external file is in the form of a file containing
- // already compiled resources, that the include line does not use '#include'
- // and that it is terminated with a semicolon.
-
- include "DoRuleFunction.rsrc" 'infn' (128);
-
- #define rlCheckSysVers 700
- #define rlBadSysVers 800
-
- #define rfCheckSystemVers 128
-
- // easy install framework uses ID other than 765 or 766
- // recommended to always use ID 764
- resource 'infr' (764) {
- format0 {{
- // execute first true rule
- // if none are true then return false
- pickFirst, { rlCheckSysVers, // check system version,
- rlBadSysVers}, // if bad give error
- }}
- };
-
- // rule that adds 7.5 or greater compatable file to Easy Install
- resource 'inrl' (rlCheckSysVers) {
- format0 {{
- // check for 7.5 or greater
- CheckRuleFunction{ rfCheckSystemVers },
-
- // if 7.5 or greater add that package
- AddPackages{{ 100 }},
- AddUserDescription{ "Rule Function Returned: TRUE.\n System version is 7.5 or greater." },
- }}
- };
-
- // rule that displays error if system is earlier than 7.5
- resource 'inrl' (rlBadSysVers) {
- format0 {{
- reportSysError {"Rule Function returned: FALSE.\n System version 7.5 or greater is required."},
- }}
- };
-
- resource 'inpk' (100) {
- format0 {
- doesntShowOnCustom,
- removable,
- dontForceRestart,
- 0,
- 0,
- "ReadMe to “Rule Function Example” folder",
- {
- 'infa', 1000 // file atom
- },
- }
- };
-
- resource 'infa' (1000) {
- format1 {
- deleteWhenRemoving,
- deleteWhenInstalling,
- copy,
- dontIgnoreLockedFile,
- dontSetFileLocked,
- useSrcCrDateToCompare, // • Use creation date for compare
- srcNeedNotExist,
- rsrcForkInRsrcFork,
- leaveAloneIfNewer, // • Do not update a newer file
- updateExisting,
- copyIfNewOrUpdate,
- rsrcFork,
- dataFork,
- 0,
- 0x0,
- 10000, // target file spec
- {
- 20000, // source file spec
- 0,
- 0
- },
-
- 0, // version number filled in by ScriptCheck
- 0, // no vers proc.
- 0, // no atom extender
- "Example File"
- }
- };
-
- resource 'inrf' (128, "Check currently running System version"){
- format0 {
- 'infn', // Rule Function Code Rsrc Type NOTE: code rsrc has C calling interface.
- 128, // Rule Function Code Rsrc ID
- 0, // RefCon Value
- 24000, // Requested Memory in bytes
- "Checking active System version"// Optional Summary String, not shown to user //
- };
- };
-
- include "Alert.rsrc"; // alert used by rule function code
-
- // target file spec for ReadMe file
- resource 'intf' (10000) {
- format1 {
- noSearchForFile, // use default search path
-
- TypeCrMustMatch, // If this is set to TypeCrMustMatch
- // then a file with a different type
- // and creator than those specified
- // below will not be replaced.
- // If this is set to TypeCrNeedNotMatch
- // then type and creator of an existing
- // target file are ignored.
-
- // The Type and Creator fields will be used to set the
- // file's Type and Creator when a new file is created.
- 'ttro', // TYPE for new file
- 'ttxt', // CREATOR for new file
-
- 0, // finder attribute flags
- // filled by ScriptCheck is value is 0
-
- 1, // creation date for new file
- 1, // modification date for new file
- // NOTE: DATE values are filled
- // by ScriptCheck if the value is 1
-
- 0, // search proc ID ( 'insp' ), none used
-
- ":Rule Function Example:Example File" // path to target file
- }
- };
-
- // source file spec for Example File file
- resource 'infs' (20000) {
- 'ttro',
- 'ttxt',
- 0x1,
- noSearchForFile,
- TypeCrMustMatch,
- "Disk1:Example File" // path to source file
- };
-